package clockwork;

import java.awt.Graphics;
import java.text.DateFormat;
import java.awt.Font;
import javax.swing.JFrame;
import javax.swing.JPanel;

public class Clock extends JFrame {

	// Clockwork clockwork = new Clockwork();

	public JPanel panel;

	private static class ClockDisplay extends JPanel {
		@Override
		public void paintComponent(Graphics g) {
			super.paintComponent(g);
			long date = Clockwork.getTime();
			DateFormat dateFormatter = DateFormat.getTimeInstance();
			g.setFont(new Font(null, Font.PLAIN, 20));
			g.drawString(dateFormatter.format(date), 20, 50);
			dateFormatter = DateFormat.getDateInstance();
			g.drawString(dateFormatter.format(date), 10, 30);
		}
	}

	public Clock() {
		panel = new ClockDisplay();
		add("Center", panel);
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		setSize(100, 100);
		setVisible(true);

	}

}
